import request from '@/utils/request'

// 车辆安全监测车主 API
export interface CarOwnerVO {
  id?: number // 编号
  carNo: string //车牌号
  ownerName: string //车主姓名
  phone: string //车主电话
  approvedPersons: number // 核准人数
  remark?: string //备注
  createtime: Date //创建时间
}

// 精简列表车主
export interface SimpleCarOwnerVO {
  id: number // 编号
  carNo: string //车牌号
  ownerName: string //车主姓名
  phone: string //车主电话
  approvedPersons: number // 核准人数
}

// 车主 API
export const CarOwnerApi = {
  // 查询车主分页
  getCarOwnerPage: async (params: any) => {
    return await request.get({ url: `/bpm/car-owner/page`, params })
  },

  // 查询车主详情
  getCarOwner: async (id: number) => {
    return await request.get({ url: `/bpm/car-owner/get?id=` + id })
  },

  // 新增车主
  createCarOwner: async (data: CarOwnerVO) => {
    return await request.post({ url: `/bpm/car-owner/create`, data })
  },

  // 修改车主
  updateCarOwner: async (data: CarOwnerVO) => {
    return await request.put({ url: `/bpm/car-owner/update`, data })
  },

  // 删除车主
  deleteCarOwner: async (id: number) => {
    return await request.delete({ url: `/bpm/car-owner/delete?id=` + id })
  },

  // 导出车主 Excel
  exportCarOwner: async (params: any) => {
    return await request.download({ url: `/bpm/car-owner/export-excel`, params })
  },

  // 获得车主精简列表
  listAllSimpleCarOwner: async (params?: any) => {
    return await request.get({ url: `/bpm/car-owner/list-all-simple`, params })
  },

  // 下载模板
  downloadTemplate: async () => {
    return await request.download({ url: `/bpm/car-owner/download-template` })
  }
}
